﻿using System;
using System.Collections.Generic;
using System.Text;
using Migrator.Framework;

namespace Blazing.DbMigration
{
    /// <summary>
    /// $DATE:  7 July 2008
    /// $DESCRIPTION:
    ///  * Adds UrlRedirects table
    /// </summary>
    [Migration(1)]
    public class Migration001 : Migration
    {
        public override void Up()
        {
            Database.AddTable("urlredirects",
                new Column("urlredirectid", System.Data.DbType.Int32, ColumnProperty.PrimaryKey | ColumnProperty.Identity),
                new Column("siteid", System.Data.DbType.Int32, ColumnProperty.NotNull),
                new Column("matchpattern", System.Data.DbType.String, 400),
                new Column("destinationresult", System.Data.DbType.String, 400),
                new Column("redirectstatuscode", System.Data.DbType.Int32),
                new Column("redirectorder", System.Data.DbType.Int32),
                new Column("rewrite", System.Data.DbType.Int32),
                new Column("active", System.Data.DbType.Int32),
                new Column("appendhostasqueryparam", System.Data.DbType.Int32),
                new Column("rowstamp", System.Data.DbType.DateTime)
                );
            Database.AddForeignKey("FK339DB9E8243FB536", "sites", "siteid", "urlredirects", "siteid");
        }

        public override void Down()
        {
            Database.RemoveForeignKey("urlredirects", "FK339DB9E8243FB536");
            Database.RemoveTable("urlredirects");
        }
    }
}



